<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<#include "/include/head_common.ftl">
	<#include "/include/login_trace.ftl">
	<#assign permissionSet = fm.getPermission() />
	<#assign edit= fm.hasPermission("sql:fieldTransform:edit",permissionSet)/>
<title>列转换器</title>
    <script type="text/javascript">
        function page(n, s) {
            $("#pageNum").val(n);
            $("#pageSize").val(s);
            $("#searchForm")[0].submit();
            return false;
        }
		function clearDescribeQuery(){
			$("#fieldName").val('');
			$("#searchForm")[0].submit();
		}
    </script>
</head>
<body>
	<ul class="nav nav-tabs">
		<#if fm.hasPermission("sql:define:view",permissionSet) >
			<li><a href="${rootUrl}/sql/define/list">SQL列表</a></li>
		</#if>
		<#if fm.hasPermission("sql:define:edit",permissionSet) >
			<li><a href="${rootUrl}/sql/define/edit">SQL添加</a></li>
		</#if>
		<#if fm.hasPermission("sql:parameter:view",permissionSet) >
			<li><a href="${rootUrl}/sql/parameter/list">SQL参数列表</a></li>
		</#if>
		<#if fm.hasPermission("sql:parameter:edit",permissionSet) >
			<li><a href="${rootUrl}/sql/parameter/edit">SQL参数添加</a></li>
		</#if>
		<li class="active"><a href="${rootUrl}/sql/fieldTransform/list?defineKey=${fieldTransform.defineKey!''}">列转换器列表</a></li>
		<#if edit >
			<li><a href="${rootUrl}/sql/fieldTransform/edit?defineKey=${fieldTransform.defineKey!''}">列转换器添加</a></li>
		</#if>
	</ul>
	<form id="searchForm" action="${rootUrl}/sql/fieldTransform/list"
		  method="post" class="breadcrumb form-search">
		<input id="pageNum" name="pageNum" type="hidden" value="${page.pageNum}" />
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />
		<label>sql定义key：</label>
		<select name="defineKey" class="input-xlarge">
			<option value="">请选择</option>
			<#list defineList as define>
				<option value="${define.defineKey}" <#if define.defineKey = fieldTransform.defineKey!''> selected </#if>>
					${define.defineKey}(${define.sqlDescribe})
				</option>
			</#list>
		</select>
		<label>列名 ：</label>
		<input type="text" id = "fieldName" name="fieldName" maxlength="50" class="input-medium" value="${fieldTransform.fieldName!''}"/> &nbsp;
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" />
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="btn btn-primary" onclick="clearDescribeQuery()" value="清除列名查询" />
	</form>
	<#include "/include/message.ftl">
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>sql定义key</th>
				<th>列名</th>
                <th>转换器</th>
				<th>操作</th>
				<th>构造参数</th>
			</tr>
		</thead>
		<tbody>
			<#list page.list as fieldTransform>
			<tr>
				<td><a href="${rootUrl}/sql/fieldTransform/list?defineKey=${fieldTransform.defineKey!''}">${fieldTransform.defineKey!''}&nbsp;(${defineMap[fieldTransform.defineKey!'']!''})</a></td>
				<td><a href="${rootUrl}/sql/fieldTransform/edit?id=${fieldTransform.id!''}">${fieldTransform.fieldName!''}</a></td>
                <td>${fieldTransform.transform!''}</td>
				<td>
					<#if edit>
						<a href="${rootUrl}/sql/fieldTransform/edit?id=${fieldTransform.id!''}">修改</a>
					    <a href="${rootUrl}/sql/fieldTransform/delete?id=${fieldTransform.id!''}" onclick="return confirmx('确认要删除该转换器吗？', this.href)">删除</a>
					<#else>
						<a href="${rootUrl}/sql/fieldTransform/edit?id=${fieldTransform.id!''}">查看</a>
					</#if>
				</td>
				<td>
					<#if (fieldTransform.constructArg!'')?length gt 80>
					${(fieldTransform.constructArg!'')?substring(0,80)}&nbsp;<label style="color: red; "><strong>...&nbsp;...</strong><label/>
						<#else>
							${fieldTransform.constructArg!''}
						</#if>
				</td>
			</tr>
			</#list>
		</tbody>
	</table>
	<div class="pagination">
		<#assign funName = 'page' />
		<#assign ftPage = page>
		<#include "/include/page.ftl">
	</div>
</body>
</html>